// 二维码点击事件
var m = document.querySelector(".flease");
var hh = document.querySelector(".head .right");

m.addEventListener("click", function() {
	hh.style.display = "none";
});

// 轮播图
var swiper = new Swiper('.center-top .swiper-container', {
	spaceBetween: 0,
	centeredSlides: true,
	autoplay: {
		delay: 2500,
		disableOnInteraction: false,
	},
	pagination: {
		el: '.swiper-pagination',
		// clickable: true,
	},
	navigation: {
		nextEl: '.swiper-button-next',
		prevEl: '.swiper-button-prev',
	},
	loop: true
});

// 轮播图
var swiper = new Swiper('.center-bottom .swiper-container', {
	spaceBetween: 0,
	centeredSlides: true,
	autoplay: {
		delay: 2500,
		disableOnInteraction: false,
	},
	pagination: {
		el: '.swiper-pagination',
		clickable: true,
		type: 'progressbar',
	},
	navigation: {
		nextEl: '.swiper-button-next',
		prevEl: '.swiper-button-prev',
	},
	loop: true
});

//轮播图
//var swiper3 = new Swiper('.lunbo .swiper-container', {
//	direction: 'vertical',
//	pagination: {
//		el: '.swiper-pagination',
//		clickable: true,
//	},
//	autoplay: {
//		delay: 2500,
//		disableOnInteraction: false,
//	},
//	loop: true
//});

// 轮播图左右箭头
var zxv = document.querySelector(".center-top .swiper-container");
var wed = document.querySelector(".center-top .swiper-button-next");
var web = document.querySelector(".center-top .swiper-button-prev");

zxv.addEventListener("mouseover", function() {
	web.style.display = "block";
	wed.style.display = "block";
});
zxv.addEventListener("mouseleave", function() {
	web.style.display = "none";
	wed.style.display = "none";
})

// 轮播图左右箭头
var zv = document.querySelector(".center-bottom .swiper-container");
var wd = document.querySelector(".center-bottom .swiper-button-next");
var wb = document.querySelector(".center-bottom .swiper-button-prev");

zv.addEventListener("mouseover", function() {
	wb.style.display = "block";
	wd.style.display = "block";
});
zv.addEventListener("mouseleave", function() {
	wb.style.display = "none";
	wd.style.display = "none";
})

// 选项卡
var asd = document.querySelectorAll(".title > li");
var asb = document.querySelectorAll(".notice > div");

for(var i = 0; i < asd.length; i++) {
	//获取下标
	asd[i].index = i;
	asd[i].addEventListener('mouseover', function() {
		for(var k = 0; k < asd.length; k++) {
			asd[k].classList.remove('active');
			asb[k].classList.remove('active');
		}
		this.classList.add('active');
		console.log(this.index);
		asb[this.index].classList.add('active');
	})
}

//var w = document.querySelector(".one-2");
//var d = document.querySelector(".module-wrap");
//
//w.addEventListener("mouseover", function() {
//	d.style.display = "block";
//})
//w.addEventListener("mouseleave", function() {
//	d.style.display = "none";
//})

// 上下轮播
setInterval(function() {

	$('.headlines .lunbo .mod').eq(0).animate({
		marginTop: -70
	}, function() {
		console.log($(this));

		$('.headlines .lunbo').append($(this));

		$(this).css('marginTop', '0px');
	})
}, 3000);

//响应式  上下轮播
setInterval(function() {

	$('.n-headlines .lunbo .mod').eq(0).animate({
		marginTop: -60
	}, function() {
		console.log($(this));

		$('.n-headlines .lunbo').append($(this));

		$(this).css('marginTop', '0px');
	})
}, 3000);

var aa = document.querySelector("#ay");
var ab = document.querySelector("#tao");
var ac = document.querySelector("#ay-1");
var ad = document.querySelector("#tao-1");
var ae = document.querySelector("#ay-2");
var af = document.querySelector("#tao-2");
var ag = document.querySelector("#ay-3");
var ah = document.querySelector("#tao-3");
var ai = document.querySelector("#ay-4");
var aj = document.querySelector("#tao-4");
var ak = document.querySelector("#ay-5");
var al = document.querySelector("#tao-5");
var am = document.querySelector("#ay-6");
var an = document.querySelector("#tao-7");
var ao = document.querySelector("#ay-8");
var ap = document.querySelector("#tao-8");
var aq = document.querySelector("#ay-9");
var ar = document.querySelector("#tao-9");
var as = document.querySelector("#ay-10");
var at = document.querySelector("#tao-10");

aa.addEventListener("mouseover", function() {
	ab.style.display = "block";
	ad.style.display = "none";
})
aa.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
})
ac.addEventListener("mouseover", function() {
	ad.style.display = "block";
	ab.style.display = "none";
})
ac.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
})
ae.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "block";
})
ae.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
})
ag.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "block";
})
ag.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
})
ai.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "block";
})
ai.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
})
ak.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "block";
})
ak.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
})
am.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	an.style.display = "block";
})
am.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	an.style.display = "none";
})
ao.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ap.style.display = "block";
})
ao.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ap.style.display = "none";
	an.style.display = "none";
})
aq.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ar.style.display = "block";
});
aq.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ap.style.display = "none";
	ar.style.display = "none";
});
as.addEventListener("mouseover", function() {
	ad.style.display = "none";
	ab.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ar.style.display = "none";
	at.style.display = "block";
});
as.addEventListener("mouseleave", function() {
	ab.style.display = "none";
	ad.style.display = "none";
	af.style.display = "none";
	ah.style.display = "none";
	aj.style.display = "none";
	al.style.display = "none";
	ap.style.display = "none";
	ar.style.display = "none";
	at.style.display = "none";
});

// 二维码移入移出事件
var wer = document.querySelector("#fiy");
var was = document.querySelector("#mean");
wer.addEventListener("mouseover", function() {
	was.style.display = "block";
});
wer.addEventListener("mouseleave", function() {
	was.style.display = "none";
});

//json数据
var vm = new Vue({
	el: '#app',
	data: {
		message: '正在请求数据...'
	},
	mounted() {
		axios
			.get('json/new.json')
			.then(response => (this.message = response.data.lists))
			.catch(function(error) {
				console.log(error);
			})
	}
});

//楼层
//获取#top
var t = document.querySelector(".lasy");
console.log(t);
window.onscroll = function() {

	var sas = document.querySelector(".head");
	var sear = document.querySelector(".seas");
	if(document.documentElement.scrollTop > 81 || document.body.scrollTop > 81) {
	    sear.style.top = "0px";
		sear.style.display = "block";
		sas.style.display = "none";
	} else {
		sear.style.top = "81px";
		sear.style.backgroundColor = "white";
		sas.style.display = "block";
		sear.style.display = "none";

	}

	var navs = document.querySelector(".n-head");
	if(document.documentElement.scrollTop > 35 || document.body.scrollTop > 35) {
		navs.style.top = "0px";
	} else {
		sear.style.top = "35px";
	}

	var rightList = document.querySelector(".lasy");
	var floor = document.querySelectorAll(".contant ul li");
	var height = document.documentElement.scrollTop || document.body.scrollTop;
		console.log(height);
	if(height >= 200 && height >= 400) {
		rightList.style.top = '100px';
		rightList.style.display='block';
	} else {
		rightList.style.top = '486px';
	}
	for(var h = 0; h < floor.length; h++) {
		floor[h].classList.remove('active');
		if(height >= 400 && height < 1700) {
			floor[0].classList.add('active');
		} else if(height >= 1700 && height < 2500) {
			floor[1].classList.add('active');
		} else if(height >= 2500 && height < 3400) {
			floor[2].classList.add('active');
		} else if(height >= 3400 && height < 4609) {
			floor[3].classList.add('active');
		} else {
			floor[4].classList.add('active');
		}
	}
	floor[0].addEventListener('click', function() {
		floor[0].classList.add('active');
		window.scrollTo({
			top: 700,
			behavior: 'smooth'
		})
	})
	floor[1].addEventListener('click', function() {
		floor[1].classList.add('active');
		window.scrollTo({
			top: 1700,
			behavior: 'smooth'
		})
	})
	floor[2].addEventListener('click', function() {
		floor[2].classList.add('active');
		window.scrollTo({
			top: 2500,
			behavior: 'smooth'
		})
	})
	floor[3].addEventListener('click', function() {
		floor[3].classList.add('active');
		window.scrollTo({
			top: 3400,
			behavior: 'smooth'
		})
	})
	floor[4].addEventListener('click', function() {
		floor[4].classList.add('active');
		window.scrollTo({
			top: 4609,
			behavior: 'smooth'
		})
	})
	floor[5].addEventListener('click', function() {
		floor[5].classList.add('active');
		window.scrollTo({
			top: 0,
			behavior: 'smooth'
		})
	})
};

//导航点击事件
var wer = document.querySelectorAll("#bth");
var cer = document.querySelectorAll("#listen");

for(var sab = 0; sab < wer.length; sab++) {
	wer[sab].bool = true;
	wer[sab].index = sab;
	wer[sab].addEventListener("click", function() {
		if(this.bool) {
			wer[this.index].style.display = "block";
			cer[this.index].style.display = "block";
		} else {
			for(var yt = 0; yt < wer.length; yt++) {
				cer[yt].style.display = "none";
			}
		}
		this.bool = !this.bool;
	})
}